package com.telecomyt.jwportal.api;

import com.telecomyt.jwportal.activity.camera.bean.CameraBean;
import com.telecomyt.jwportal.activity.collect.bean.CollectBean;
import com.telecomyt.jwportal.activity.login.bean.LoginBean;
import com.telecomyt.jwportal.activity.person.bean.PersonInfoBean;
import com.telecomyt.jwportal.activity.register.bean.RegisterBean;
import com.telecomyt.jwportal.bean.BannerBean;
import com.telecomyt.jwportal.bean.UsersBean;
import com.telecomyt.jwportal.entity.OnLineBean;
import com.telecomyt.jwportal.http.base.BaseResponse;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * 接口定义类
 */
public interface HttpApi {
    String URL_PERSON = "url_name:person";
    String URL_COLLECT = "url_name:collect";
    String URL_ONLINE = "url_name:online";

    @GET("/musicRankingsDetails")
    Observable<CameraBean> musicRankingsDetails(@Query("type") int type);

    @FormUrlEncoded
    @POST("user/register")
    Observable<RegisterBean> register(@Field("username") String username, @Field("password") String password, @Field("repassword") String repassword);

    @FormUrlEncoded
    @POST("user/login")
    Observable<LoginBean> login(@Field("username") String username, @Field("password") String password);

    @GET("user/logout/json")
    Observable<Object> logout();

    @GET("banner/json")
    Observable<BannerBean> banner();

    @Headers(URL_PERSON)
    @POST("ucenter/dept/users")
    Observable<BaseResponse<UsersBean>> users(@Body RequestBody body);

    /**
     * 个人信息
     */
    @Headers(URL_PERSON)
    @POST("ucenter/member/get")
    Observable<BaseResponse<PersonInfoBean>> getPerson(@Body RequestBody body);

    /**
     * 我的收藏
     */
    @Headers(URL_COLLECT)
    @GET("favorite/get")
    Observable<BaseResponse<CollectBean>> favorite(@Query("userId") int userId, @Query("tenantId") int tenantId);

    @Headers(URL_ONLINE)
    @POST("api/plink/status/online/user")
    Observable<OnLineBean> onlineUser(@Body RequestBody body);


}
